<?php

namespace app\admin\model\zhongzhuan\baiying;

use think\Model;


class Byaitask extends Model
{

    

    

    // 表名
    protected $name = 'ec_ai_task';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text'
    ];
    
    
    
    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'),'2' => __('Status 2'),];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    
    public function getCallJobStatusList()
    {
        return [
            'callJobStatus 0' => __('callJobStatus 0'), 'callJobStatus 1' => __('callJobStatus 1'), 'callJobStatus 2' => __('callJobStatus 2'),
            'callJobStatus 3' => __('callJobStatus 3'), 'callJobStatus 4' => __('callJobStatus 4'), 'callJobStatus 5' => __('callJobStatus 5'),
            'callJobStatus 6' => __('callJobStatus 6'), 'callJobStatus 7' => __('callJobStatus 7'), 'callJobStatus 8' => __('callJobStatus 8'),
            'callJobStatus 9' => __('callJobStatus 9'),'callJobStatus 10' => __('callJobStatus 10')
        ];
    }


    public function getCallJobStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['callJobStatus']) ? $data['callJobStatus'] : '');
        $list = $this->getCallJobStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    

    

    public function getStartDateAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['startDate']) ? $data['startDate'] : '');
        
        return empty($value)? 0 : ($value / 1000);
        
    }





}
